Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix a flaky test #2386

Merged
merged 1 commit into from
Jul 18, 2021
Merged

fix a flaky test #2386

merged 1 commit into from
Jul 18, 2021

Conversation

moogician
Copy link

@moogician moogician commented Jul 16, 2021

A flaky test is found in this project and this PR proposes to fix it.

  1. How to reproduce the flaky test
  • The project is built and tested under javaJDK8.
  • The tool used for the flaky test detection is NonDex.
  • I ran mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=fr.xephi.authme.listener.PlayerListenerTest#shouldHideChatFromUnauthed, which produces
    PlayerListenerTest.shouldHideChatFromUnauthed:348 Expected: iterable containing [<Mock for Player, hashCode: 775174220>, <Mock for Player, hashCode: 810672306>] but: item 0: was <Mock for Player, hashCode: 810672306>.
  1. Why the test failed
  • The method org.bukkit.event.player.AsyncPlayerChatEvent.getRecipients() called in the test fr.xephi.authme.listener.PlayerListenerTest.shouldHideChatFromUnauthed returns a set, which does not guarantee the order of the elements in it.
  1. The changes made
  • The contains in shouldHideChatFromUnauthed is changed to containsInAnyOrder, and the function org.hamcrest.Matchers.containsInAnyOrder is imported instead of org.hamcrest.Matchers.contains.

@moogician moogician closed this Jul 16, 2021
@moogician moogician reopened this Jul 16, 2021
@ljacqu
Copy link
Member

ljacqu commented Jul 18, 2021

Makes sense, thanks

@ljacqu ljacqu merged commit 3e6c9b1 into AuthMe:master Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants